package com.cx.service.impl;

import com.cx.mapper.WheelMapper;
import com.cx.pojo.Wheel;
import com.cx.service.WheelService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WheelServiceImpl implements WheelService {

    @Autowired
    WheelMapper wheelMapper;

    @Override
    public int insert(Wheel wheel) {
        return wheelMapper.insert(wheel);
    }

    @Override
    public int updateByPrimaryKey(Wheel wheel) {
        return wheelMapper.updateByPrimaryKey(wheel);
    }

    @Override
    public int deleteByPrimaryKey(Integer eId) {
        return wheelMapper.deleteByPrimaryKey(eId);
    }

    @Override
    public Wheel selectByPrimaryKey(Integer eId) {
        return wheelMapper.selectByPrimaryKey(eId);
    }

    //分页
    public PageInfo<Wheel> selectAllWheel(Wheel wheel) {
        PageHelper.startPage(wheel.getPageNum(), wheel.getPageSize());
        List<Wheel> wheelList = wheelMapper.selectAllWheel(wheel);
        return new PageInfo<>(wheelList);
    }
}
